﻿@model ConsoleApplication2.Models.CalendarModel

@{
    ViewBag.Title = "Booking Calendar";
}
@using System.Web.Script.Serialization



@{
    Layout = null;
}
<script>
var rooms = @Html.Raw(new JavaScriptSerializer().Serialize(Model.Rooms));
	//Add a helper that we’ll need later:
	//returns room name by id
	function getRoom(id) {
		for (var i in rooms) {
			if (rooms[i].key == id)
				return rooms[i].english;
		}
		return "";
	}
	// Popup window code
	function newPopup(url) {
	    popupWindow = window.open(
            url, 'popUpWindow', 'height=700,width=800,left=10,top=10,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
	}
	function updateValue(arabic,v, recordID)
	{
	    // this gets called from the popup window and updates the field with a new value
	    document.getElementById("name").value = v;
	    document.getElementById("aname").value = arabic;
	    document.getElementById("patID").value = recordID;
	}
	attachRules()
	{
        

	    scheduler.templates.event_class = function(start, end, event){
	        var className = "";
	        if(event.start_date.valueOf()  < new Date().valueOf()){
	            className = "old_event";
	        }else if(event.user_id){    
	            className = "user_" + event.user_id;
	        }
	        return className;
	    };


	   
	    scheduler.templates.event_text = scheduler.templates.agenda_text = scheduler.templates.event_bar_text = function(start,end,ev){
	        return getRoom(ev.room_id)+' : ' + ev.text;
	    }
	    scheduler.templates.week_agenda_event_text = function(start,end,ev){
	        return scheduler.templates.event_date(ev.start_date) + ' ' +getRoom(ev.room_id)+' : ' + ev.text;
	    }
	}
        </script>



        <style>
            html, body {
            margin: 0;
            padding: 0;
            height: 100%;
            overflow: auto;
            }

        body {
            background: #5c87b2;
            background-image: url(./bg.png);
            font-size: .75em;
            font-family: "Segoe UI", Verdana, Helvetice, Sans-Serif;
            margin: 0;
            padding: 0;
            color: #393939;
        }

        .page {
            width: 1020px;
            margin: 0 auto;
        }

        #calendar {
            height: 600px;
            margin-top: 20px;
        }

        a:link, a:visited {
            color: #ff0000;
            text-decoration: underline;
        }

        a:hover {
            text-decoration: none;
        }


        /*header line*/
        .head_line {
            background-color: #2e3b49;
            height: 15px;
            padding: 8px 0;
        }

        .head_inner {
            margin: 0 auto;
            width: 1020px;
        }

        .head_inner, .head_inner {
            color: #efefef;
        }


        /* additional styles for login page*/


        #logindisplay {
            font-size: 1.1em;
            display: block;
            text-align: right;
            margin: 10px;
            color: White;
        }

            #logindisplay a:link, #logindisplay a:visited {
            color: white;
                text-decoration: underline;
            }

            #logindisplay a:hover {
            color: white;
                text-decoration: none;
            }



        .editor-label {
            margin-top: 10px;
            line-height: 120%;
            height: 20px;
            cursor: pointer;
        }

        .editor-label input {
            border: 1px solid #e2e2e2;
        }

        .editor-label label {
            font-size: 13px;
        }

        .editor-label input, .editor-label label {
            vertical-align: middle;
        }

        #login {
            background-color: #d3dce0;
            border: 1px solid #787878;
            cursor: pointer;
            padding: 4px;
            margin-left: 10px;
            font-size: 1.2em;
        }

            #searchform {
                margin-left: auto;
                margin-right: auto;
                width: 70%;
                background-color: #FFFFFF;
                border: 1px solid #FFFFFF;
                cursor: pointer;
                padding: 10px;
                font-size: 1.0em;
                width: 1000px;
                align-content: center;
            }

        /*override some of scheduler colors*/
        /*week agenda and month event text color*/
        .dhx_wa_ev_body, .dhx_cal_event_clear {
            color: #efefef !important;
        }

        .dhx_cal_event .dhx_header,
        .dhx_cal_event .dhx_footer,
        .dhx_cal_event .dhx_body,
        .dhx_cal_event .dhx_title {
            border-color: white !important;
        }
       #main
        {
            height:810px;
        }
            .green_section {
                background-color: #77ff77;
                opacity: 0.25;
            } 

        </style>


<br />
<br />
<div id="searchform" dir="rtl" >
@using (Html.BeginForm())
{
    <fieldset>

        <div>

            المعالج :

            @Html.DropDownList("doctors")

            القسم :

            @Html.DropDownList("sp")

            -

            المريض
            :
            @{
                    String patID = "";
                    String name = "";
                    String aname = "";
                    if(ViewBag.name != null)
                    {
                        name = ViewBag.name;
                    }
                    if (ViewBag.aname != null)
                    {
                        aname = ViewBag.aname;
                    }
                    if (ViewBag.patID != null)
                    {
                        patID = ViewBag.patID;
                    }
                    
                               }
            <input type="text" value="@name" id="name" name="name" />
            -

            <input type="text" value="@aname" id="aname" name="aname" />
            -

            <a href="JavaScript:newPopup('../Customers/Search');">اختار المريض</a>

            -
            <input type="hidden" value="@patID" id="patID" name="patID" />

            <input type="submit" value="ارسل" />
        </div>
    </fieldset>
}

</div>

        <div id="calendar">
            @Html.Raw(Model.Scheduler.Render())
        </div>



